@import "Connector";

$diagram-designer-selection-rubber-band-background-color: rgba(219, 234, 252, 0.49);
$diagram-designer-selection-rubber-band-border-color: #52A8EC;
$diagram-designer-selection-outline-background-color: rgba(255, 255, 0, 0.05);
$diagram-designer-selection-outline-border: rgba(0, 0, 0, 0.5) dashed 1px;
$diagram-designer-selection-outline-shadow-start: rgba(0, 0, 0, 0.075);
$diagram-designer-selection-outline-shadow-end: rgba(0, 0, 0, 0.3);
$diagram-designer-selection-outline-s-btn-background-color: #FFFFFF;
$diagram-designer-selection-outline-s-btn-shadow-start: rgba(0, 0, 0, 0.075);
$diagram-designer-selection-outline-s-btn-shadow-end: rgba(0, 0, 0, 0.3);

/*error decorator properties*/
$error-decorator-background-color: #F2DEDE;

$accept-droppable-background-color: rgba(0, 255, 0, 0.1);
$reject-droppable-background-color: rgba(255, 0, 0, 0.1);

$path-edit-segment-color: rgba(0, 0, 0, 0);
$new-segment-point-marker-background-color: #FFFF00;
$new-segment-point-marker-border-color: #FF0000;
$segment-point-marker-background-color: #FFFF00;
$segment-point-marker-border-color: #000000;
$segment-point-marker-hover-background-color: #FF7800;
$segment-point-move-path-color: #FF7800;
$segment-point-bezier-control-marker-background-color: #FFFFFF;
$segment-point-bezier-control-marker-border-color: #000000;

$connection-end-src-connector-border-color: #FF0000;
$connection-end-dst-connector-border-color: #0000FF;

$connection-connector-background-color: #FFFFFF;

$rotation-deg-color: #666666;

$connection-drawing-connector-background-color: #00FF00;

$tabs-container-height: 26px;

.diagram-designer {
  outline: none;

  .items {
    position: absolute;

    .designer-item,
    .designer-connection {
      cursor: pointer;
      &.selected {
        z-index: 1;
      }
    }

    .rubberband {
      background: $diagram-designer-selection-rubber-band-background-color;
      border: $diagram-designer-selection-rubber-band-border-color solid 1px;
      z-index: 100000;
    }

    .selection-outline {
      background: $diagram-designer-selection-outline-background-color;
      border: $diagram-designer-selection-outline-border;
      position: absolute;
      pointer-events: none;
      z-index: 100;
      -webkit-box-shadow: inset 0 1px 1px $diagram-designer-selection-outline-shadow-start 0 0 4px $diagram-designer-selection-outline-shadow-end;
      -moz-box-shadow: inset 0 1px 1px $diagram-designer-selection-outline-shadow-start, 0 0 4px $diagram-designer-selection-outline-shadow-end;
      box-shadow: inset 0 1px 1px $diagram-designer-selection-outline-shadow-start, 0 0 4px $diagram-designer-selection-outline-shadow-end;

      .s-btn {
        position: absolute;
        background-color: $diagram-designer-selection-outline-s-btn-background-color;
        border: none;
        line-height: 14px;
        padding: 3px 4px;
        border-radius: 4px;
        pointer-events: all;
        cursor: pointer;
        -webkit-box-shadow: inset 0 1px 1px $diagram-designer-selection-outline-s-btn-shadow-start 0 0 4px $diagram-designer-selection-outline-s-btn-shadow-end;
        -moz-box-shadow: inset 0 1px 1px $diagram-designer-selection-outline-s-btn-shadow-start, 0 0 4px $diagram-designer-selection-outline-s-btn-shadow-end;
        box-shadow: inset 0 1px 1px $diagram-designer-selection-outline-s-btn-shadow-start, 0 0 4px $diagram-designer-selection-outline-s-btn-shadow-end;
        background-color: #000;
        color: #fff;

        &.delete {
          top: -13px;
          right: -13px;
        }

        &.rotate {
          &.bottom {
            left: 50%;
            margin-left: -13px;
            bottom: -13px;
          }
        }

        &.contextmenu {
          bottom: -13px;
          right: -13px;
        }

        &.align {
          bottom: -13px;
          left: -13px;
        }

        &.move {
          top: -13px;
          left: -13px;
          margin-left: -13px;
        }

        &.open {
          top: -13px;
          left: -13px;
        }

        &:hover {
          background-color: #428bca;
        }
      }

      .rotation-deg {
        text-align: center;
        vertical-align: middle;
        position: absolute;
        width: 100%;
        height: 30px;
        margin-top: -15px;
        top: 50%;
        line-height: 30px;
        font-size: 30px;
        color: $rotation-deg-color;
      }
    }

    .connection-connector {
      &.connector {
        @include connector_basics;

        background-color: $connection-connector-background-color;
        border-radius: 10px;
        height: 6px;
        width: 6px;

        margin-left: -4px;
        margin-top: -4px;
      }
    }

    .c-area {
      position: absolute;
      width: 8px;
      height: 8px;
      background-color: #000000;
      border-radius: 4px;
      margin-top: -4px;
      margin-left: -4px;
    }

    .c-d-end {
      @include connector_basics;
      margin-top: $connector-size / -2;
      margin-left: $connector-size / -2;
      line-height: $connector-size - $connector-border-width * 2;
      font-size: $connector-size - $connector-border-width * 2 - 2;
      text-align: center;
      font-weight: bold;
      font-family: Verdana;

      &.src {
        border-color: $connection-end-src-connector-border-color;
        color: $connection-end-src-connector-border-color;
      }

      &.dst {
        border-color: $connection-end-dst-connector-border-color;
        color: $connection-end-dst-connector-border-color;
      }
    }

    .error-decorator {
      background-color: $error-decorator-background-color;
      padding: 3px;
      text-align: center;
      border: 2px solid #000000;
    }

    svg.connection-container {

      z-index: -1;

      .designer-connection {
        &.designer-connection-shadow {
          &.connection-hover,
          &:hover {
            opacity: 0.5 !important;
          }
        }
      }

      .new-segment-point-marker {
        pointer-events: none;
        fill: $new-segment-point-marker-background-color;
        stroke: $new-segment-point-marker-border-color;
      }

      .path-edit-segment {
        stroke: $path-edit-segment-color;
        opacity: 0;
      }

      .segment-point {
        fill: $segment-point-marker-background-color;
        stroke: $segment-point-marker-border-color;
        cursor: pointer;

        &:hover {
          fill: $segment-point-marker-hover-background-color;
        }
      }

      .segment-point-move-path {
        stroke: $segment-point-move-path-color;
      }

      .segment-point-bezier-control {
        fill: $segment-point-bezier-control-marker-background-color;
        stroke: $segment-point-bezier-control-marker-border-color;
        cursor: pointer;

        &:hover {
          fill: $segment-point-marker-hover-background-color;
        }
      }
    }

    div.c-t {
      position: absolute;
      top: 0;
      left: 0;
      width: 0;
      height: 0;

      div.c-text {
        position: absolute;
        font-size: 10px;
        white-space: nowrap;

        .c-name {
          position: relative;
          left: -50%;
          cursor: default;

          &.v {
            left: 1px;
          }
        }

        input {
          height: 20px !important;
          min-width: 50px;
        }
      }

      &.is-selected {
        .c-text {
          .c-name,
          .c-dst,
          .c-src {
            background-color: #B9DCF7;
            padding: 2px 2px 2px 2px;
            margin-left: -2px;
            border-radius: 2px;
            z-index: 4;
            &.editing {
              z-index: -3;
            }
            &.v {
              left: 1px;
            }
          }
        }
      }
    }

    &.highlight-mode {
      .designer-item,
      .designer-connection,
      .c-t {
        opacity: 0.1;
        cursor: pointer;
      }

      .designer-item.highlighted,
      .designer-connection.highlighted,
      .c-t.highlighted {
        opacity: 1.0;
      }
    }

    &.connection-drawing {
      .connector {
        &:hover {
          background-color: $connection-drawing-connector-background-color;
        }
      }
    }
  }

  .drop-region {
    width: 0;
    height: 0;
    position: absolute;
    top: 0;
    left: 0;

    &.accept-droppable {
      background-color: $accept-droppable-background-color;
    }

    &.reject-droppable {
      background-color: $reject-droppable-background-color;
    }
  }
}

.diagram-designer-zoom-container {
  position: absolute;
  top: 40px;
  left: 10px;
}

.w-tabs {
  .diagram-designer-zoom-container {
    top: 70px;
  }
}

div.diagram-designer-drag-outline {
  white-space: nowrap;
}

/* TABS CONTAINER */

.active-panel .diagram-designer-tabs-container {
  background-color: #F7FAFF;
}

.diagram-designer-tabs-container {
  position: absolute;
  left: 0;
  top: 3px;
  width: 100%;
  height: $tabs-container-height;
  background-color: #FDFDFD;

  padding-top: 1px;

  > div {
    display: table-cell;
    vertical-align: middle;
    white-space: nowrap;
  }

  div.add-tab-container {
    border-bottom: 1px solid #ddd;
    padding-left: 3px;
    padding-right: 3px;
    padding-bottom: 0;
  }

  div.add-tab-container {
    > div {
      display: inline-block;
      margin-right: 3px;
    }
  }

  div.add-tab-container {
    ul.dropdown-menu {
      li {
        a {
          [class^="icon-"],
          [class*=" icon-"] {
            margin-left: -17px;
            margin-right: 3px;
          }
        }
      }
    }
  }

  .btn {
    padding: 0 12px;
  }

  div.tab-list-container {
    width: 100%;
    overflow: hidden;

    ul.nav {
      position: relative;
      margin-bottom: 0px;
      height: 24px;

      &.nav-tabs {
        > li {
          display: inline-block;
          float: none;

          > a {
            padding-top: 5px;
            padding-bottom: 5px;
            line-height: 13px;

            .tab-title {
              white-space: nowrap;
              display: inline-block;
              max-width: 120px;
              overflow: hidden;
              text-overflow: ellipsis;

              input {
                min-width: 50px !important;
              }
            }

            i.delete-tab-btn {
              cursor: pointer;
              font-size: 100%;
              margin-left: 5px;
              &:hover {
                color: #b30404;
              }
            }

            [class^="icon-"],
            [class*=" icon-"] {
              margin-top: -2px;
              margin-left: 2px;
              cursor: pointer;
              display: none;
            }
          }

          &.active {
            > a {
              [class^="icon-"],
              [class*=" icon-"] {
                display: inline-block;
              }
            }
          }
        }

        &.ui-sortable {
          li.ui-sortable-placeholder {
            height: 0px !important;
          }

          li.ui-sortable-helper {
            top: 0px !important;
            pointer-events: none;
          }
        }
      }
    }
  }
}

.read-only {
  .diagram-designer-tabs-container {
    div.tab-list-container {
      ul.nav {
        &.nav-tabs {
          > li {
            &.active {
              > a {
                [class^="icon-"],
                [class*=" icon-"] {
                  display: none;
                }
              }
            }
          }
        }
      }
    }
  }
}

.rotate-options {
  top: -52px;
  left: 16px;
  display: none;
}
